var {
    JSDOM
} = require('jsdom');

var fs = require('fs');



JSDOM.fromURL("http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201703/t20170310_1471429.html").then(dom => {
    const document = dom.window.document
    let a = document.querySelectorAll("p.MsoNormal");
    // for(let a1 in a){
    //     console.log(a1);
    // }
    a.forEach(element => {
        fs.appendFile('data.txt', element.textContent.trim()+"\n", (err) => {
            if (err) throw err;
            console.log('The "data to append" was appended to file!');
        });
    });

});